package com.sea.base.bean

/**
 * @param message 其他端返回的信息
 * @param msg 服务端返回的信息
 */
open class BaseResp(
    @JvmField val code: Int = 0,
    @JvmField val message: String = "",
    @JvmField val msg: String = message,
) {
    companion object {
        /**
         * 服务端成功
         */
        const val SUCCESS_CODE = 200

        const val LOGIN_OUT_CODE = 403

        /**
         * 长连接时，app异常cod码
         */
        const val APP_NO_RESPONSE_ERROR = -699
        const val APP_CODE_ERROR = -698
        const val APP_NO_LISTENER = -697

        val successResp = BaseResp(code = SUCCESS_CODE)

        fun codeErrorResp(msg: String) = BaseResp(APP_CODE_ERROR, msg)
    }

    val realMessage get() = message.ifEmpty { msg }
}